package org.gruposp2p.dnie.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.gruposp2p.dnie.model.xmladapter.BooleanAdapter;
import org.gruposp2p.dnie.model.xmladapter.DNIeDocumentToSignOptionAdapter;

/**
 *
 * @author jj
 */
@XmlType
@XmlRootElement(name = "DNIeSignedDocumentOptionSelected")
@XmlAccessorType(XmlAccessType.NONE)
@Entity
@Table(name = "DNIESIGNEDDOCUMENTOPTIONSELECTED", catalog = "DNIE")
@NamedQueries({@NamedQuery(name = "DNIeSignedDocumentOptionSelected.findAll", query = "SELECT d FROM DNIeSignedDocumentOptionSelected d"), @NamedQuery(name = "DNIeSignedDocumentOptionSelected.findById", query = "SELECT d FROM DNIeSignedDocumentOptionSelected d WHERE d.id = :id"), @NamedQuery(name = "DNIeSignedDocumentOptionSelected.findBySelected", query = "SELECT d FROM DNIeSignedDocumentOptionSelected d WHERE d.selected = :selected")})
public class DNIeSignedDocumentOptionSelected implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID", nullable = false)
    @GeneratedValue(strategy = GenerationType.AUTO)
    @XmlElement
    private Integer id;
    @Basic(optional = false)
    @Column(name = "SELECTED", nullable = false)
    @XmlElement
    @XmlJavaTypeAdapter(BooleanAdapter.class)
    private Serializable selected;
    @JoinColumn(name = "DNIEDOCUMENTTOSIGNOPTION_ID", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    @XmlElement
    @XmlJavaTypeAdapter(DNIeDocumentToSignOptionAdapter.class)
    private DNIeDocumentToSignOption dnieDocumentToSignOptionId;
    @JoinColumn(name = "DNIESIGNEDDOCUMENT_ID", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    private DNIeSignedDocument dnieSignedDocumentId;

    public DNIeSignedDocumentOptionSelected() {
    }

    public DNIeSignedDocumentOptionSelected(Integer id) {
        this.id = id;
    }

    public DNIeSignedDocumentOptionSelected(Integer id, Serializable selected) {
        this.id = id;
        this.selected = selected;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Serializable getSelected() {
        return selected;
    }

    public void setSelected(Serializable selected) {
        this.selected = selected;
    }

    public DNIeDocumentToSignOption getDNIeDocumentToSignOptionId() {
        return dnieDocumentToSignOptionId;
    }

    public void setDNIeDocumentToSignOptionId(DNIeDocumentToSignOption dnieDocumentToSignOptionId) {
        this.dnieDocumentToSignOptionId = dnieDocumentToSignOptionId;
    }

    public DNIeSignedDocument getDnieSignedDocumentId() {
        return dnieSignedDocumentId;
    }

    public void setDnieSignedDocumentId(DNIeSignedDocument dnieSignedDocumentId) {
        this.dnieSignedDocumentId = dnieSignedDocumentId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DNIeSignedDocumentOptionSelected)) {
            return false;
        }
        DNIeSignedDocumentOptionSelected other = (DNIeSignedDocumentOptionSelected) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "dniedatabasemodel01.DNIeSignedDocumentOptionSelected[id=" + id + "]";
    }

}
